package com.wangzhenyu.learn.test.designPattern


//桥接模式


interface Brand {

    fun open()

    fun close()

    fun call()
}

@Suppress("UNUSED")
class ViVo : Brand {

    override fun open() {
        println("ViVo 开机")
    }

    override fun close() {
        println("ViVo 关机")
    }

    override fun call() {
        println("ViVo 拨打电话")
    }
}

@Suppress("UNUSED")
class LittleMi : Brand {

    override fun open() {
        println("XiaoMi 开机")
    }

    override fun close() {
        println("XiaoMi 关机")
    }

    override fun call() {
        println("XiaoMi 拨打电话")
    }
}


abstract class CommonPhone(private val brand: Brand) {

    open fun open() {
        brand.open()
    }

    open fun close() {
        brand.close()
    }

    open fun call() {
        brand.call()
    }

}

@Suppress("UNUSED")
class FoldedPhone(brand: Brand) : CommonPhone(brand) {

    override fun open() {
        super.open()
        println("折叠手机")
    }

    override fun close() {
        super.close()
        println("折叠手机")
    }

    override fun call() {
        super.call()
        println("折叠手机")
    }
}



